Joomla.submitbutton = function(task)
{
	if (task == '') {
		return false;
	} else {
		var isValid=true;
		var action = task.split('.');
		if (action[1] != 'cancel' && action[1] != 'close') {
			var forms = $$('form.form-validate');
			for (var i=0;i<forms.length;i++) {
				if (!document.formvalidator.isValid(forms[i])) {
					isValid = false;
					break;
				}
			}
		}
		if (isValid) {
			Joomla.submitform(task);
			return true;
		} else {
			alert('Vui lòng nhập thông tin vào những ô còn bắt buộc');
			return false;
		}
	}
}

function handleDigit(event)
{
	if ( event.which == 46 || event.which == 8 || event.which == 9 || event.which == 27 || event.which == 13 ||
			// Allow: Ctrl+A
			((event.which == 65 || event.which == 90) && event.ctrlKey === true) ||
			// Allow: home, end, left, right
			(event.which >= 35 && event.which <= 39) || event.which == 110 || event.which == 190) {
		// let it happen, don't do anything
		return;
	}
	else {
		// Ensure that it is a number and stop the keypress
		if (event.shiftKey || (event.which < 48 || event.which > 57) && (event.which < 96 || event.which > 105 )) {
			event.preventDefault();
		}
	}
}